#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int my_atoi(const char* p) {
	int flag = 1;
	while (isspace(*p)) {
		p++;
	}
	if (*p == '+' ) {
		p++;
	}
	else if(*p == '-')
	{
		flag = -1;
		p++;
	}
	int ret = 0;
	while (*p != '\0') {
		if (isdigit(*p)) {
			ret = ret * 10 + (*p - '0') * flag;
		}
		else
		{
			return ret;
		}
		p++;
	}
	return ret;
}
int main()
{
	const char* str = "   -123AVVC";
	int c= my_atoi(str);
	printf("%d", c);
	return 0;
}